﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace NHibernate.Audit
{
    public static class DbCommandExtensions
    {

        public static IDbDataParameter AddParameter(this IDbCommand cmd, string name, object value)
        {
            var param = cmd.CreateParameter();
            param.ParameterName = name;
            param.Value = value;
            cmd.Parameters.Add(param);
            return param;
        }

        public static IDbDataParameter AddParameter(this IDbCommand cmd, string name, DbType type)
        {
            var param = cmd.CreateParameter();
            param.ParameterName = name;
            param.DbType = type;
            cmd.Parameters.Add(param);
            return param;
        }

        public static IDbDataParameter AddParameter(this IDbCommand cmd, string name, DbType type, int size)
        {
            var param = cmd.CreateParameter();
            param.ParameterName = name;
            param.DbType = type;
            param.Size = size;
            cmd.Parameters.Add(param);
            return param;
        }



    }
}
